Skip to content

Conversation

@jaclync
Copy link
Contributor

@jaclync jaclync commented Nov 18, 2022

Part of #8108

Description

Using an IAP mock

There is still an IAP backend issue (p1668419146340439-slack-C025A8VV728) that results in a Server could not read response failure (p1668592527610099/1668419146.340439-slack-C025A8VV728) when I tested purchasing the eCommerce plan. In order to unblock us from testing and developing the store creation flow, I decided to create a mock implementation of InAppPurchasesForWPComPlansProtocol in debug builds using the DEBUG macro and a feature flag storeCreationM2WithInAppPurchasesEnabled to easily turn it on and off. The DEBUG macro is used so that the mock struct isn't included in non-debug builds, since it's generally a good practice not to include mock/debug classes in production builds. If you feel like the use of the macro makes it harder to read, I can also remove the macro condition since it's only temporary.

Changes to navigation bar title & back button styles

Because the store name form (StoreNameForm) and plan purchase view (StoreCreationPlanView) screens do not use any navigation bar title, before this PR a gap is shown below the navigation bar for these screens. I struggled with various navigation bar title styles in all different screens in the flow, sometimes disabling the large title style in one screen results in the next screen not being able to show a large title. I also got stuck on hiding the back button in the navigation bar for StoreCreationPlanView. After debugging for a while, I realized that the issues were from having SwiftUI view in a UIHostingController and setting navigation bar title and back button in the hosting controller 🤦🏻‍♀️ As a result, I changed the navigation bar title and back button configurations from the hosting controller to the SwiftUI view.

Changes to StoreCreationCoordinator

Using the IAP interface InAppPurchasesForWPComPlansProtocol, we can now integrate the whole flow with each step in place. To wait for the newly created site to become a Jetpack site, I copied most of the logic from M1 implementation but the site ID subscription feels a bit odd to me since it never changes. Please feel free to suggest a better solution not using Combine.

Testing instructions

  • Log in if needed
  • Go to the Menu tab, and tap Switch store
  • On the store picker, tap + Add a store
  • Tap Create a new store --> an in-progress modal should be shown briefly, then dismissed. the store name form is then presented
  • Enter some store name and tap Continue when ready --> the store name should be used for the initial domain query in the next screen
  • Search for another domain if you like, and select one domain to Continue --> a free Simple site should be created, and a store summary screen is shown with the store name and site slug
  • Tap Continue to payment --> the eCommerce plan should be shown
  • Tap Create Store for $69.99/month --> an in-progress screen should be shown about creating the store. after the site becomes available in the /me/sites response, the success screen should be shown
  • Tap Manage My Store to continue to the new site in the app --> a WC version alert is probably shown because it's a Simple site without WC

Screenshots

simulator.mov

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

… to become a Jetpack site --> continue with the new Atomic site.
* feat/8117-store-name-form:
  Show store name form as the first screen in the store creation flow that continues to the domain selector.
  Create store name form for store creation.
  8079 Remove plugins.sync to fix payment cancellation
  Simpler name.
  Add feature area to preparing reader release note
  Remove errors related to other PurchaseResult cases
  8079 Add Preparing Card Reader spinner to 11.3
  Update tests to match changes to flow
  8079 Show spinner while preparing reader for payment
  8079Add PreparingReader card reader modal
  8079 Add Indefinite progress view style
  Add descriptions for IAP Store errors
  Better text.
  Use environment variable to get test site id for IAP
  Improve error handling in the IAP store
  Show an alert in the IAP debug screen when a purchase fails

# Conflicts:
#	WooCommerce/Classes/Authentication/Store Creation/StoreCreationCoordinator.swift
* feat/8117-store-name-form:
  Update store name text field placeholder based on the latest design.
  Update `StoreCreationCoordinatorTests` now that store name form becomes the first screen.
* trunk:
  Remove trailing whitespace.
  Typealias the purchase result type
  Include purchase result in purchaseProduct API
  Verify last navigation step in create_new_order test
  Distribute WCiOS Prototype Builds to Collaborators
  Makes a simpler version of the sandbox warning. Only show alert if the sandbox environment url is not setup.
  Make WordPressApiError conform to LocalizedError so it shows in alerts
  Remove unnecessary `discardableResult`s from UnifiedOrderScreen
  Remove unnecessary `discardableResult`s from SingleOrderScreen
  Add additional ElementGetter to init
  Remove 2 `discardableResult`s from UnifiedOrderScreen
  Add a warning text and alert to remind the importance of setting up the sandbox.
  Update test name to match conventions
  Ignore API errors when an order already exists
  Pause transaction listener while purchasing
  Update test coverage documentation for edit order UI test
  Rename the test
  Add action to close Order Edit flow in UI test
  Add products check in Order Edit UI test
…tegration

* feat/8118-store-creation-success: (22 commits)
  Create `StoreCreationSuccessView` and its hosting controller for store creation success screen.
  Remove redundant period
  Remove background color on empty stores cell
  Rename enum Strings to Links
  Fix test failure for AuthenticationManager
  Revert unnecessary changes
  Remove the navigation to the native jetpack flow from the site address login flow
  Fix issue navigating to the native jetpack flow from the site address login flow
  Update unit test ULErrorViewController with the terms label
  Add unit tests for JetpackSetupRequiredViewModel
  Make termsLabelText an NSAttributedString instead of Publisher
  Add terms label to the jetpack setup required screen
  Add help button on Jetpack setup required
  Navigate to native jetpack flow from AuthenticationManager
  Add JetpackSetupRequiredViewModel
  Add terms label to ULErrorViewController
  Embed labels on the empty store screen in a stack view
  Update empty store screen with new image and copies
  Add temporary feature flag for the native jetpack setup flow
  Update IconsTests with new assets
  ...
* trunk:
  StoreCreationSuccessView: replace fixed bottom view below the scroll view by using `safeAreaInset` from CR suggestion.
  Clear products onboarding banner and resync announcements when a product is added
  Trigger add product flow for products onboarding without switching tabs
  Remove not needed functions.
  Cleanup tests for removed auth tools
  Remove unused wp-com auth tools from WebKitVC
…instead of pushing it to the navigation stack (with an odd background glitch).
… hosting controller to SwiftUI view to fix large title issues.
@jaclync jaclync changed the title Store creation M2: integrate with mock IAP Store creation M2: integrate with mock IAP to test the entire flow Nov 18, 2022
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Nov 18, 2022

You can test the changes from this Pull Request by:
  • Clicking here or scanning the QR code below to access App Center
  • Then installing the build number pr8154-9fdf543 on your iPhone

If you need access to App Center, please ask a maintainer to add you.

@jaclync jaclync marked this pull request as ready for review November 18, 2022 10:23
@jaclync jaclync added type: task An internally driven task. status: feature-flagged Behind a feature flag. Milestone is not strongly held. labels Nov 18, 2022
@jaclync jaclync added this to the 11.4 milestone Nov 18, 2022
@selanthiraiyan selanthiraiyan self-assigned this Nov 21, 2022
Copy link
Contributor

@selanthiraiyan selanthiraiyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚢 🎉


// MARK: - Store creation M2

/// This property is kept as a lazy var instead of a dependency in the initializer because `InAppPurchasesForWPComPlansManager` is a @MainActor.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for explaining in the comments.

* trunk: (42 commits)
  Freeze strings for localization
  Release Notes: add new section for next version (11.4)
  Update draft release notes for 11.3.
  Bump version number
  Add a root view for the analytics hub
  Hide analytics hub button behind feature flag
  Animate analytics hub button during stats loading state
  Add analytics hub button on the stats dashboard
  Add a new feature flag for the analytics hub
  Update Experiments/Experiments/FeatureFlag.swift
  Add feature flag for adding SSR to support request
  Remove 💜 character from release notes
  Bump version number
  Update metadata translations
  Update app translations – `Localizable.strings`
  Add reset button
  Fix layout for the eye button
  Update error code and domain check for wrong credentials
  Add top padding to bottom button
  Use `SecureField` for showsSecureInput
  ...
* trunk:
  Update sample stats with averageOrderValue from mock
  Update metadata strings
  Update release notes for 11.3
  Add averageOrderValue to OrderStatsV4Totals storage entity
  Use Decimal type for consistent stats data handling
  Add Average Order Value to OrderStatsV4Totals model
@peril-woocommerce
Copy link

Warnings
⚠️ This PR is assigned to a milestone which is closing in less than 2 days Please, make sure to get it merged by then or assign it to a later expiring milestone

Generated by 🚫 dangerJS

@jaclync jaclync merged commit 91905fc into trunk Nov 24, 2022
@jaclync jaclync deleted the feat/8108-iap-integration branch November 24, 2022 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: feature-flagged Behind a feature flag. Milestone is not strongly held. type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants